package com.icedata.sika.bridge

import com.icedata.sika.core.Sika
import net.mamoe.mirai.Bot
import net.mamoe.mirai.contact.MemberPermission.*

object SikaStatus {

    fun getBotPermission(sika: Sika, groupID: Long): SikaGroupContact.SikaGroupMember.Permission {
        val bot = Bot.getInstance(sika.config.qq)
        return when (bot.getGroup(groupID)?.botAsMember?.permission!!) {
            MEMBER -> SikaGroupContact.SikaGroupMember.Permission.Member
            ADMINISTRATOR -> SikaGroupContact.SikaGroupMember.Permission.Admin
            OWNER -> SikaGroupContact.SikaGroupMember.Permission.Owner
        }
    }
}